package guet.imagan.progbuilder.impl;

import guet.imagan.progbuilder.DefaultInterpreter;
import guet.imagan.progbuilder.Interpreter;
import guet.imagan.progbuilder.Project;
import guet.imagan.progbuilder.annotation.InterpreteCommand;
import guet.imagan.util.ListUtil;

import java.io.File;
import java.util.List;

@InterpreteCommand(interpreterName = "Java解释器", FileExtension = {"java"},
		commandWithWindow = {"cmd", "/k", "start", "java",
				"-classpath", "{classPath}", "{main}"},
		commandWithoutWindow = {"java", "-classpath", "{classPath}", "{main}"})
public class JavaInterpreter extends DefaultInterpreter {

	@Override
	public void populatePlaceholders(List<String> cmd, Project project) {
		super.populatePlaceholders(cmd, project);
		ListUtil.replaceFirst(cmd,"{classPath}",
				project.getOutputDir().getAbsolutePath());
	}
}
